/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package UI;

import BL.BLFuncionario;
import BL.BLMantenimiento;
import BO.Funcionario;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JComboBox;
import javax.swing.JOptionPane;
import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException;
import javax.swing.text.DocumentFilter;
import javax.swing.text.PlainDocument;

/**
 *
 * @author Guigo
 */
public class FrmManteUsuarios extends javax.swing.JFrame {

    /**
     * Creates new form manteUsuarios
     */
    public FrmManteUsuarios() {
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPaneControles = new javax.swing.JPanel();
        togAdd = new javax.swing.JToggleButton();
        togEdit = new javax.swing.JToggleButton();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        txtNombre = new javax.swing.JTextField();
        txtApellido1 = new javax.swing.JTextField();
        txtApellido2 = new javax.swing.JTextField();
        cbUnidadTrabajo = new javax.swing.JComboBox();
        cbRol = new javax.swing.JComboBox();
        cbSupervisor = new javax.swing.JComboBox();
        jLabel7 = new javax.swing.JLabel();
        txtID = new javax.swing.JTextField();
        btnBuscar = new javax.swing.JButton();
        btnAccion = new javax.swing.JButton();
        jLabel9 = new javax.swing.JLabel();
        cbGerencia = new javax.swing.JComboBox();
        btnCancelar = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowOpened(java.awt.event.WindowEvent evt) {
                formWindowOpened(evt);
            }
        });

        togAdd.setSelected(true);
        togAdd.setText("Agregar");
        togAdd.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                togAddActionPerformed(evt);
            }
        });

        togEdit.setText("Editar");
        togEdit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                togEditActionPerformed(evt);
            }
        });

        jLabel1.setText("Nombre");

        jLabel2.setText("Primer Apellido");

        jLabel3.setText("Segundo Apellido");

        jLabel4.setText("Unidad de Trabajo");

        jLabel5.setText("Rol");

        jLabel6.setText("Supervisor");

        cbUnidadTrabajo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        cbUnidadTrabajo.setToolTipText("");
        cbUnidadTrabajo.setEnabled(false);

        cbRol.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));

        cbSupervisor.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));

        jLabel7.setText("Cedula");

        btnBuscar.setText("Buscar");
        btnBuscar.setToolTipText("La busqueda tambien se puede realizar por nombre y apellidos.");
        btnBuscar.setEnabled(false);
        btnBuscar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnBuscarActionPerformed(evt);
            }
        });

        btnAccion.setText("Agregar Usuario");
        btnAccion.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAccionActionPerformed(evt);
            }
        });

        jLabel9.setText("Gerencia");

        cbGerencia.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "----" }));
        cbGerencia.setSelectedItem("----");
        cbGerencia.setToolTipText("");
        cbGerencia.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                cbGerenciaItemStateChanged(evt);
            }
        });
        cbGerencia.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cbGerenciaActionPerformed(evt);
            }
        });

        btnCancelar.setText("Cancelar");
        btnCancelar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCancelarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPaneControlesLayout = new javax.swing.GroupLayout(jPaneControles);
        jPaneControles.setLayout(jPaneControlesLayout);
        jPaneControlesLayout.setHorizontalGroup(
            jPaneControlesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPaneControlesLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(togAdd)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(togEdit)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addGroup(jPaneControlesLayout.createSequentialGroup()
                .addGap(16, 16, 16)
                .addGroup(jPaneControlesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel6)
                    .addComponent(jLabel1)
                    .addComponent(jLabel2)
                    .addComponent(jLabel3)
                    .addComponent(jLabel5)
                    .addComponent(jLabel7)
                    .addComponent(jLabel9))
                .addGap(18, 18, 18)
                .addGroup(jPaneControlesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPaneControlesLayout.createSequentialGroup()
                        .addComponent(cbGerencia, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGap(18, 18, 18)
                        .addComponent(jLabel4)
                        .addGap(139, 139, 139))
                    .addGroup(jPaneControlesLayout.createSequentialGroup()
                        .addGroup(jPaneControlesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(txtApellido2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(cbRol, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(cbSupervisor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txtApellido1, javax.swing.GroupLayout.PREFERRED_SIZE, 337, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txtNombre, javax.swing.GroupLayout.PREFERRED_SIZE, 337, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(jPaneControlesLayout.createSequentialGroup()
                                .addComponent(btnAccion)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(btnCancelar))
                            .addComponent(cbUnidadTrabajo, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 111, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addContainerGap())
                    .addGroup(jPaneControlesLayout.createSequentialGroup()
                        .addComponent(txtID)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnBuscar)
                        .addGap(146, 146, 146))))
        );

        jPaneControlesLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {cbRol, cbSupervisor, txtApellido1, txtApellido2, txtNombre});

        jPaneControlesLayout.setVerticalGroup(
            jPaneControlesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPaneControlesLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPaneControlesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(togAdd)
                    .addComponent(togEdit))
                .addGap(37, 37, 37)
                .addGroup(jPaneControlesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel7)
                    .addComponent(txtID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnBuscar))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPaneControlesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(txtNombre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPaneControlesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(txtApellido1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPaneControlesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel3)
                    .addComponent(txtApellido2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPaneControlesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel4)
                    .addComponent(cbUnidadTrabajo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel9)
                    .addComponent(cbGerencia, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPaneControlesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel5)
                    .addComponent(cbRol, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPaneControlesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel6)
                    .addComponent(cbSupervisor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPaneControlesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnAccion)
                    .addComponent(btnCancelar))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        PlainDocument doc = new PlainDocument();
        doc.setDocumentFilter(new DocumentFilter() {
            @Override
            public void insertString(FilterBypass fb, int off, String str, AttributeSet attr)
            throws BadLocationException
            {
                fb.insertString(off, str.replaceAll("\\D++", ""), attr);  // remove non-digits
            }
            @Override
            public void replace(FilterBypass fb, int off, int len, String str, AttributeSet attr)
            throws BadLocationException
            {
                fb.replace(off, len, str.replaceAll("\\D++", ""), attr);  // remove non-digits
            }
        });
        txtID.setDocument(doc);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPaneControles, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPaneControles, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void togAddActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_togAddActionPerformed
        togEdit.setSelected(false);
        btnBuscar.setEnabled(false);
        btnAccion.setText("Agregar Usuario");
        btnAccion.setEnabled(true);
    }//GEN-LAST:event_togAddActionPerformed

    private void togEditActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_togEditActionPerformed
        togAdd.setSelected(false);
        btnBuscar.setEnabled(true);
        btnAccion.setText("Editar Usuario");
        btnAccion.setEnabled(false);
    }//GEN-LAST:event_togEditActionPerformed

    private void btnAccionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAccionActionPerformed

        if (togAdd.isSelected()) {
            if (txtID.getText().equals("")) {
                txtID.setText("0");
            }
            if (!(Integer.parseInt(txtID.getText()) == 0
                    || txtNombre.getText().equals("")
                    || txtApellido1.getText().equals("")
                    || txtApellido2.getText().equals("")
                    || cbGerencia.getSelectedItem().toString().equals("----")
                    || cbRol.getSelectedItem().toString().equals("----")
                    || cbSupervisor.getSelectedItem().toString().equals("----")
                    || cbUnidadTrabajo.getSelectedItem().toString().equals("----"))) {

                BLMantenimiento bl = new BLMantenimiento();
                String supSelected = cbSupervisor.getSelectedItem().toString();
                String cedulaAutoriza = supSelected.substring(supSelected.length() - 9);
                String nombreRol = "";
                try {
                    bl.agregarFuncionario(Integer.parseInt(txtID.getText()),
                            txtNombre.getText(),
                            txtApellido1.getText(),
                            txtApellido2.getText(),
                            cbGerencia.getSelectedItem().toString(),
                            cbUnidadTrabajo.getSelectedItem().toString(),
                            cedulaAutoriza,
                            nombreRol);
                    JOptionPane.showMessageDialog(null, "El usuario fue agregado con exito a la base de datos.");

                } catch (SQLException ex) {
                    JOptionPane.showMessageDialog(null, "No se pudo agregar el usuario. " + ex.toString());
                    Logger.getLogger(FrmManteUsuarios.class.getName()).log(Level.SEVERE, null, ex);
                }
            } else {
                JOptionPane.showMessageDialog(null, "Todos los campos son obligatorios. Por favor complete la informacion solicitada.");
            }
        } else {
            if (txtID.isEnabled()) {
                JOptionPane.showMessageDialog(null, "Es necesario realizar la busqueda antes de guardar los cambios");
            } else {
                BLMantenimiento bl
                        = new BLMantenimiento();
                String supSelected = cbSupervisor.getSelectedItem().toString();
                String cedulaAutoriza = supSelected.substring(supSelected.length() - 9);
                String nombreRol = "";
                try {
                    bl.actualizarFuncionario(Integer.parseInt(txtID.getText()),
                            txtNombre.getText(),
                            txtApellido1.getText(),
                            txtApellido2.getText(),
                            cbGerencia.getSelectedItem().toString(),
                            cbUnidadTrabajo.getSelectedItem().toString(),
                            cedulaAutoriza,
                            nombreRol);
                    JOptionPane.showMessageDialog(null, "La informacion del usuario fue actualizada correctamente.");

                } catch (SQLException ex) {
                    JOptionPane.showMessageDialog(null, "No se pudo actualizar la informacion del usuario. \n" + ex.toString());
                    Logger.getLogger(FrmManteUsuarios.class.getName()).log(Level.SEVERE, null, ex);
                }

            }
        }
    }//GEN-LAST:event_btnAccionActionPerformed

    private void formWindowOpened(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowOpened

        cbRol.removeAllItems();
        cbSupervisor.removeAllItems();
        cbUnidadTrabajo.removeAllItems();
        cbUnidadTrabajo.addItem("----");

        BLMantenimiento bl = new BLMantenimiento();
        try {
            cbGerencia.removeAllItems();
            cbGerencia.addItem("----");
            fillComboBox(cbGerencia, bl.listarGerencias());
        } catch (SQLException ex) {
            JOptionPane.showMessageDialog(null, "Ocurrio un error al obtener las gerencias de la empresa./n"
                    + ex.toString());
            Logger.getLogger(FrmManteUsuarios.class.getName()).log(Level.SEVERE, null, ex);
        }
        try {
            fillComboBox(cbRol, bl.listarRoles());
        } catch (SQLException ex) {
            JOptionPane.showMessageDialog(null, "Ocurrio un error al obtener la lista de roles./n"
                    + ex.toString());
            Logger.getLogger(FrmManteUsuarios.class.getName()).log(Level.SEVERE, null, ex);
        }
        try {
            fillComboBox(cbSupervisor, bl.listarSupervisores());
        } catch (SQLException ex) {
            JOptionPane.showMessageDialog(null, "Ocurrio un error al obtener la lista de supervisores./n"
                    + ex.toString());
            Logger.getLogger(FrmManteUsuarios.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_formWindowOpened

    private void cbGerenciaItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_cbGerenciaItemStateChanged
        if (cbGerencia.getSelectedItem() != null) {
            if (!cbGerencia.getSelectedItem().toString().equals("----")) {
                BLMantenimiento bl = new BLMantenimiento();
                cbUnidadTrabajo.setEnabled(true);
                cbUnidadTrabajo.removeAllItems();
                try {
                    fillComboBox(cbUnidadTrabajo, bl.listarUnidadesDT(cbGerencia.getSelectedItem().toString()));
                } catch (SQLException ex) {
                    JOptionPane.showMessageDialog(null, "Ocurrio un error al obtener la lista de Unidades de Trabajo./n"
                            + ex.toString());
                    Logger.getLogger(FrmManteUsuarios.class.getName()).log(Level.SEVERE, null, ex);
                }
            } else {
                cbUnidadTrabajo.setEnabled(false);
            }
        }
    }//GEN-LAST:event_cbGerenciaItemStateChanged

    private void btnBuscarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBuscarActionPerformed
        Funcionario f = new Funcionario();
        BLFuncionario blF = new BLFuncionario();
        try {
            f = blF.obtenerFuncionario(Integer.parseInt(txtID.getText()));
            txtID.setEnabled(false);
            txtNombre.setText(f.getNombre());
            txtApellido1.setText(f.getPrimerApellido());
            txtApellido2.setText(f.getSegundoApellido());
            btnAccion.setEnabled(true);
        } catch (SQLException ex) {
            JOptionPane.showMessageDialog(null, "Verifique que el formato de la cedula sean 9 números consecutivos.");
        }
    }//GEN-LAST:event_btnBuscarActionPerformed

    private void btnCancelarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCancelarActionPerformed
        txtID.setEnabled(true);
        txtID.setText("");
        txtNombre.setText("");
        txtApellido1.setText("");
        txtApellido2.setText("");
    }//GEN-LAST:event_btnCancelarActionPerformed

    private void cbGerenciaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbGerenciaActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_cbGerenciaActionPerformed

    private void fillComboBox(JComboBox comboBox, ArrayList<String> list) {
        comboBox.removeAllItems();
        for (String dato : list) {
            comboBox.addItem(dato);
        }
    }

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(FrmManteUsuarios.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(FrmManteUsuarios.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(FrmManteUsuarios.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(FrmManteUsuarios.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            @Override
            public void run() {
                new FrmManteUsuarios().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnAccion;
    private javax.swing.JButton btnBuscar;
    private javax.swing.JButton btnCancelar;
    private javax.swing.JComboBox cbGerencia;
    private javax.swing.JComboBox cbRol;
    private javax.swing.JComboBox cbSupervisor;
    private javax.swing.JComboBox cbUnidadTrabajo;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPaneControles;
    private javax.swing.JToggleButton togAdd;
    private javax.swing.JToggleButton togEdit;
    private javax.swing.JTextField txtApellido1;
    private javax.swing.JTextField txtApellido2;
    private javax.swing.JTextField txtID;
    private javax.swing.JTextField txtNombre;
    // End of variables declaration//GEN-END:variables
}
